package com.mt.components.log {
	import mx.rpc.remoting.mxml.RemoteObject;

	/**      
	 * 文件名称：MLogger<br>
	 * 文件描述：<br>
	 * 创建人：马腾<br>
	 * 创建时间：Nov 24, 2012 11:03:14 PM<br>
	 * 修改人：马腾<br>
	 * 修改时间：Nov 24, 2012 11:03:14 PM<br>
	 */
	public class MLogger implements Logger {
		
		public static const DEBUG:String = "DEBUG";
		public static const INFO:String = "INFO";
		public static const WARN:String = "WARN";
		public static const ERROR:String = "ERROR";
		
		public var pack:String;
		public var printStr:String;
		
		public function debug(message:String):void {
			getPrintStr(DEBUG);
			printMessage(printStr + message);
		}
		
		public function info(message:String):void {
			getPrintStr(INFO);
			printMessage(printStr + message);
		}
		
		public function warn(message:String):void {
			getPrintStr(WARN);
			printMessage(printStr + message);
		}
		
		public function error(message:String):void {
			getPrintStr(ERROR);
			printMessage(printStr + message);
		}
		
		private function getPrintStr(type:String):void {
			printStr = "[" + type + "] [" + pack + "] "; 
		}
		
		private function printMessage(message:String):void {
			var remote:RemoteObject = new RemoteObject("FlexLogPrint");
			remote.print(message);
		}
	}
}